package com.sizu.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sizu.common.statisticaldto.TSaleStatementDto;
import com.sizu.common.vo.ResultEntity;
import com.sizu.entity.TPurchaseStatementZyx;
import com.sizu.entity.TSaleStatementZyx;
import com.sizu.service.ITSaleStatementService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 赵玉玺
 * @since 2020-02-29
 */
@RestController
@RequestMapping("/statistical/tSaleStatement")
public class TSaleStatementController {

    @Resource
    private ITSaleStatementService itSaleStatementService;

    /**
     * 查询销售统计
     * @param tSaleStatementDto
     * @return
     */
    @RequestMapping("/list")
    public ResultEntity tSaleStatementList(TSaleStatementDto tSaleStatementDto){
        PageHelper.startPage(tSaleStatementDto.getPageNum(),tSaleStatementDto.getPageSize());
        TSaleStatementZyx SaleStatementZyx=new TSaleStatementZyx();
        BeanUtils.copyProperties(tSaleStatementDto,SaleStatementZyx);
        List<TSaleStatementZyx> saleStatementList = itSaleStatementService.getSaleStatementList(SaleStatementZyx);
        PageInfo<TSaleStatementZyx> pageInfo=new PageInfo<>(saleStatementList);
        return ResultEntity.ok("查询成功",pageInfo);
    }

}
